﻿' LibWowArmory
' by Ronald M. Clifford (roncli@roncli.com)
'
' This source code is released under the GNU Library General Public License (LGPL) Version 2.1.

Imports System

Namespace roncliProductions.LibWowArmory.Item.Search

    ''' <summary>
    ''' A class that encapsulates a single advanced option filter
    ''' </summary>
    ''' <remarks></remarks>
    Public Class AdvancedOptionsFilter

        Friend Property AdvancedOptions As String
        Friend Property [Operator] As String
        Friend Property Range As Integer

        ''' <summary>
        ''' The type of advanced option to filter for
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property AdvancedOptionsFilter As Enums.AdvancedOptionsType
            Get
                Select Case AdvancedOptions
                    Case "strength"
                        Return Enums.AdvancedOptionsType.BaseStat_Strength
                    Case "agility"
                        Return Enums.AdvancedOptionsType.BaseStat_Agility
                    Case "stamina"
                        Return Enums.AdvancedOptionsType.BaseStat_Stamina
                    Case "intellect"
                        Return Enums.AdvancedOptionsType.BaseStat_Intellect
                    Case "spirit"
                        Return Enums.AdvancedOptionsType.BaseStat_Spirit
                    Case "critRating"
                        Return Enums.AdvancedOptionsType.General_CritRating
                    Case "hitRating"
                        Return Enums.AdvancedOptionsType.General_HitRating
                    Case "hasteRating"
                        Return Enums.AdvancedOptionsType.General_HasteRating
                    Case "attackPower"
                        Return Enums.AdvancedOptionsType.PhysicalCombat_AttackPower
                    Case "feralAttackPower"
                        Return Enums.AdvancedOptionsType.PhysicalCombat_FeralAttackPower
                    Case "ignoreArmor"
                        Return Enums.AdvancedOptionsType.PhysicalCombat_ArmorPenetration
                    Case "expertiseRating"
                        Return Enums.AdvancedOptionsType.PhysicalCombat_ExpertiseRating
                    Case "spellPower"
                        Return Enums.AdvancedOptionsType.Spell_SpellPower
                    Case "spellCritRating"
                        Return Enums.AdvancedOptionsType.Spell_SpellCritRating
                    Case "spellHitRating"
                        Return Enums.AdvancedOptionsType.Spell_SpellHitRating
                    Case "spellPenetration"
                        Return Enums.AdvancedOptionsType.Spell_Penetration
                    Case "spellManaRegen"
                        Return Enums.AdvancedOptionsType.Spell_ManaRegen
                    Case "spellHasteRating"
                        Return Enums.AdvancedOptionsType.Spell_SpellHasteRating
                    Case "spellDamageArcane"
                        Return Enums.AdvancedOptionsType.Spell_ArcaneDamage
                    Case "spellDamageHoly"
                        Return Enums.AdvancedOptionsType.Spell_HolyDamage
                    Case "spellDamageShadow"
                        Return Enums.AdvancedOptionsType.Spell_ShadowDamage
                    Case "spellDamageNature"
                        Return Enums.AdvancedOptionsType.Spell_NatureDamage
                    Case "spellDamageFrost"
                        Return Enums.AdvancedOptionsType.Spell_FrostDamage
                    Case "spellDamageFire"
                        Return Enums.AdvancedOptionsType.Spell_FireDamage
                    Case "armor"
                        Return Enums.AdvancedOptionsType.Defense_Armor
                    Case "blockRating"
                        Return Enums.AdvancedOptionsType.Defense_BlockRating
                    Case "blockValue"
                        Return Enums.AdvancedOptionsType.Defense_BlockValue
                    Case "defenseRating"
                        Return Enums.AdvancedOptionsType.Defense_DefenseRating
                    Case "dodgeRating"
                        Return Enums.AdvancedOptionsType.Defense_DodgeRating
                    Case "parryRating"
                        Return Enums.AdvancedOptionsType.Defense_ParryRating
                    Case "healthRegen"
                        Return Enums.AdvancedOptionsType.Defense_HealthRegen
                    Case "resilience"
                        Return Enums.AdvancedOptionsType.Defense_Resilience
                    Case "resistArcane"
                        Return Enums.AdvancedOptionsType.Resistance_ArcaneResist
                    Case "resistShadow"
                        Return Enums.AdvancedOptionsType.Resistance_ShadowResist
                    Case "resistNature"
                        Return Enums.AdvancedOptionsType.Resistance_NatureResist
                    Case "resistFrost"
                        Return Enums.AdvancedOptionsType.Resistance_FrostResist
                    Case "resistFire"
                        Return Enums.AdvancedOptionsType.Resistance_FireResist
                    Case "dps"
                        Return Enums.AdvancedOptionsType.Weapon_Dps
                    Case "minDamage"
                        Return Enums.AdvancedOptionsType.Weapon_MinDamage
                    Case "maxDamage"
                        Return Enums.AdvancedOptionsType.Weapon_MaxDamage
                    Case "speed"
                        Return Enums.AdvancedOptionsType.Weapon_Speed
                    Case "bindsPickedUp"
                        Return Enums.AdvancedOptionsType.General_BindOnPickup
                    Case "bindsEquip"
                        Return Enums.AdvancedOptionsType.General_BindOnEquip
                    Case "bindsWhenUsed"
                        Return Enums.AdvancedOptionsType.General_BindOnUse
                    Case "unique"
                        Return Enums.AdvancedOptionsType.General_Unique
                    Case "uniqueEquipped"
                        Return Enums.AdvancedOptionsType.General_UniqueEquipped
                    Case "hasSpellEffect_resist"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_ChanceToResist
                    Case "hasSpellEffect_interrupt"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_AvoidInterruption
                    Case "hasSpellEffect_proc"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_ChanceOnHitOrCast
                    Case "hasSpellEffect_dispel"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_DispelEffects
                    Case "hasSpellEffect_cooldown"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_ReduceCooldown
                    Case "hasSpellEffect_casttime"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_ReduceCastTime
                    Case "hasSpellEffect_spellcost"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_ReduceSpellCost
                    Case "hasSpellEffect_duration"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_IncreaseDuration
                    Case "hasSpellEffect_range"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_IncreaseRange
                    Case "hasSpellEffect_threat"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_ReduceThreat
                    Case "hasSpellEffect_group"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_GroupBuff
                    Case "hasSpellEffect_summon"
                        Return Enums.AdvancedOptionsType.General_SpellEffect_SummonCreature
                    Case Else
                        Return Nothing
                End Select
            End Get
            Set(ByVal value As Enums.AdvancedOptionsType)
                Select Case value
                    Case Enums.AdvancedOptionsType.BaseStat_Strength
                        AdvancedOptions = "strength"
                    Case Enums.AdvancedOptionsType.BaseStat_Agility
                        AdvancedOptions = "agility"
                    Case Enums.AdvancedOptionsType.BaseStat_Stamina
                        AdvancedOptions = "stamina"
                    Case Enums.AdvancedOptionsType.BaseStat_Intellect
                        AdvancedOptions = "intellect"
                    Case Enums.AdvancedOptionsType.BaseStat_Spirit
                        AdvancedOptions = "spirit"
                    Case Enums.AdvancedOptionsType.General_CritRating
                        AdvancedOptions = "critRating"
                    Case Enums.AdvancedOptionsType.General_HitRating
                        AdvancedOptions = "hitRating"
                    Case Enums.AdvancedOptionsType.General_HasteRating
                        AdvancedOptions = "hasteRating"
                    Case Enums.AdvancedOptionsType.PhysicalCombat_AttackPower
                        AdvancedOptions = "attackPower"
                    Case Enums.AdvancedOptionsType.PhysicalCombat_FeralAttackPower
                        AdvancedOptions = "feralAttackPower"
                    Case Enums.AdvancedOptionsType.PhysicalCombat_ArmorPenetration
                        AdvancedOptions = "ignoreArmor"
                    Case Enums.AdvancedOptionsType.PhysicalCombat_ExpertiseRating
                        AdvancedOptions = "expertiseRating"
                    Case Enums.AdvancedOptionsType.Spell_SpellPower
                        AdvancedOptions = "spellPower"
                    Case Enums.AdvancedOptionsType.Spell_SpellCritRating
                        AdvancedOptions = "spellCritRating"
                    Case Enums.AdvancedOptionsType.Spell_SpellHitRating
                        AdvancedOptions = "spellHitRating"
                    Case Enums.AdvancedOptionsType.Spell_Penetration
                        AdvancedOptions = "spellPenetration"
                    Case Enums.AdvancedOptionsType.Spell_ManaRegen
                        AdvancedOptions = "spellManaRegen"
                    Case Enums.AdvancedOptionsType.Spell_SpellHasteRating
                        AdvancedOptions = "spellHasteRating"
                    Case Enums.AdvancedOptionsType.Spell_ArcaneDamage
                        AdvancedOptions = "spellDamageArcane"
                    Case Enums.AdvancedOptionsType.Spell_HolyDamage
                        AdvancedOptions = "spellDamageHoly"
                    Case Enums.AdvancedOptionsType.Spell_ShadowDamage
                        AdvancedOptions = "spellDamageShadow"
                    Case Enums.AdvancedOptionsType.Spell_NatureDamage
                        AdvancedOptions = "spellDamageNature"
                    Case Enums.AdvancedOptionsType.Spell_FrostDamage
                        AdvancedOptions = "spellDamageFrost"
                    Case Enums.AdvancedOptionsType.Spell_FireDamage
                        AdvancedOptions = "spellDamageFire"
                    Case Enums.AdvancedOptionsType.Defense_Armor
                        AdvancedOptions = "armor"
                    Case Enums.AdvancedOptionsType.Defense_BlockRating
                        AdvancedOptions = "blockRating"
                    Case Enums.AdvancedOptionsType.Defense_DefenseRating
                        AdvancedOptions = "defenseRating"
                    Case Enums.AdvancedOptionsType.Defense_DodgeRating
                        AdvancedOptions = "dodgeRating"
                    Case Enums.AdvancedOptionsType.Defense_ParryRating
                        AdvancedOptions = "parryRating"
                    Case Enums.AdvancedOptionsType.Defense_HealthRegen
                        AdvancedOptions = "healthRegen"
                    Case Enums.AdvancedOptionsType.Defense_Resilience
                        AdvancedOptions = "resilience"
                    Case Enums.AdvancedOptionsType.Resistance_ArcaneResist
                        AdvancedOptions = "resistArcane"
                    Case Enums.AdvancedOptionsType.Resistance_ShadowResist
                        AdvancedOptions = "resistShadow"
                    Case Enums.AdvancedOptionsType.Resistance_NatureResist
                        AdvancedOptions = "resistNature"
                    Case Enums.AdvancedOptionsType.Resistance_FrostResist
                        AdvancedOptions = "resistFrost"
                    Case Enums.AdvancedOptionsType.Resistance_FireResist
                        AdvancedOptions = "resistFire"
                    Case Enums.AdvancedOptionsType.Weapon_Dps
                        AdvancedOptions = "dps"
                    Case Enums.AdvancedOptionsType.Weapon_MinDamage
                        AdvancedOptions = "minDamage"
                    Case Enums.AdvancedOptionsType.Weapon_MaxDamage
                        AdvancedOptions = "maxDamage"
                    Case Enums.AdvancedOptionsType.Weapon_Speed
                        AdvancedOptions = "speed"
                    Case Enums.AdvancedOptionsType.General_BindOnPickup
                        AdvancedOptions = "bindsPickedUp"
                    Case Enums.AdvancedOptionsType.General_BindOnEquip
                        AdvancedOptions = "bindsEquip"
                    Case Enums.AdvancedOptionsType.General_BindOnUse
                        AdvancedOptions = "bindsWhenUsed"
                    Case Enums.AdvancedOptionsType.General_Unique
                        AdvancedOptions = "unique"
                    Case Enums.AdvancedOptionsType.General_UniqueEquipped
                        AdvancedOptions = "uniqueEquipped"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_ChanceToResist
                        AdvancedOptions = "hasSpellEffect_resist"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_AvoidInterruption
                        AdvancedOptions = "hasSpellEffect_interrupt"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_ChanceOnHitOrCast
                        AdvancedOptions = "hasSpellEffect_proc"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_DispelEffects
                        AdvancedOptions = "hasSpellEffect_dispel"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_ReduceCooldown
                        AdvancedOptions = "hasSpellEffect_cooldown"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_ReduceCastTime
                        AdvancedOptions = "hasSpellEffect_casttime"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_ReduceSpellCost
                        AdvancedOptions = "hasSpellEffect_spellcost"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_IncreaseDuration
                        AdvancedOptions = "hasSpellEffect_duration"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_IncreaseRange
                        AdvancedOptions = "hasSpellEffect_range"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_ReduceThreat
                        AdvancedOptions = "hasSpellEffect_threat"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_GroupBuff
                        AdvancedOptions = "hasSpellEffect_group"
                    Case Enums.AdvancedOptionsType.General_SpellEffect_SummonCreature
                        AdvancedOptions = "hasSpellEffect_summon"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The type of operator to use with the advanced option filter
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property OperatorFilter As Enums.AdvancedOptionsOperatorType
            Get
                Select Case [Operator]
                    Case "gt"
                        Return Enums.AdvancedOptionsOperatorType.GreaterThan
                    Case "gteq"
                        Return Enums.AdvancedOptionsOperatorType.GreaterThanEqualTo
                    Case "eq"
                        Return Enums.AdvancedOptionsOperatorType.EqualTo
                    Case "lt"
                        Return Enums.AdvancedOptionsOperatorType.LessThan
                    Case "lteq"
                        Return Enums.AdvancedOptionsOperatorType.LessThanEqualTo
                    Case Else
                        Return Nothing
                End Select
            End Get
            Set(ByVal value As Enums.AdvancedOptionsOperatorType)
                If AdvancedOptionsFilter > Enums.AdvancedOptionsType.Weapon_Speed Then
                    Throw New InvalidOperationException("You cannot assign an operator to this option.")
                    Exit Property
                End If
                Select Case value
                    Case Enums.AdvancedOptionsOperatorType.GreaterThan
                        [Operator] = "gt"
                    Case Enums.AdvancedOptionsOperatorType.GreaterThanEqualTo
                        [Operator] = "gteq"
                    Case Enums.AdvancedOptionsOperatorType.EqualTo
                        [Operator] = "eq"
                    Case Enums.AdvancedOptionsOperatorType.LessThan
                        [Operator] = "lt"
                    Case Enums.AdvancedOptionsOperatorType.LessThanEqualTo
                        [Operator] = "lteq"
                End Select
            End Set
        End Property

        ''' <summary>
        ''' The range to be used with the operator for the advanced option filter
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property RangeFilter As Integer
            Get
                Return Range
            End Get
            Set(ByVal value As Integer)
                If AdvancedOptionsFilter > Enums.AdvancedOptionsType.Weapon_Speed Then
                    Throw New InvalidOperationException("You cannot set a range to this option.")
                    Exit Property
                End If
                If value < 0 Then
                    Throw New ArgumentOutOfRangeException("value", "The Range must be greater than or equal to zero.")
                    Exit Property
                End If
                Range = value
            End Set
        End Property

    End Class

End Namespace
